using System;
using System.Collections;

namespace Algorithms.Placement
{
	public interface IPlacement
	{

		bool IsEmpty();

		void Add(object entity);

		object Get();

		object Peek();
	}

	public class StackPlacement : IPlacement
	{
		protected Stack stack;

		public StackPlacement()
		{
			stack = new Stack();
		}

		#region IPlacement Members

		public bool IsEmpty()
		{
			return stack.Count == 0;
		}

		public void Add(object entity)
		{
			stack.Push(entity);
		}

		public object Get()
		{
			return stack.Pop();
		}

		public object Peek()
		{
			return stack.Peek();
		}

		#endregion

	}

	public class QueuePlacement : IPlacement
	{
		protected Queue queue;

		public QueuePlacement()
		{
			queue = new Queue();
		}

		#region IPlacement Members

		public bool IsEmpty()
		{
			return queue.Count == 0;
		}

		public void Add(object entity)
		{
			queue.Enqueue(entity);
		}

		public object Get()
		{
			return queue.Dequeue();
		}

		public object Peek()
		{
			return queue.Peek();
		}

		#endregion

	}


}